<%--
  Created by IntelliJ IDEA.
  User: 14587
  Date: 2020/11/6
  Time: 17:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录页面</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/script/js/jquery-1.7.2.js"></script>
    <script>
        function a1() {
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/a3",
                data:{"name":$("#username").val(),"password":$("#password").val()},
                success:function (data) {
                    if (data.toString()=="ok"){
                        $("#userMsg").css("color","green");
                    }else{
                        $("#userMsg").css("color","red");
                    }
                    $("#userMsg").html(data);
                }
            })
        }
        function a2() {
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/a3",
                data:{"name":$("#username").val(),"password":$("#password").val()},
                success:function (data) {
                    if (data.toString()=="ok"){
                        $("#pwdMsg").css("color","green");
                    }else {
                        $("#pwdMsg").css("color","red");
                    }
                    $("#pwdMsg").html(data);
                }
            })
        }
    </script>
</head>
<body>
<p>
    用户名<input type="text" id="username" onblur="a1()">
    <div id="userMsg"></div>
</p>
<p>
    密码<input type="text" id="password" onblur="a2()">
    <div id="pwdMsg"></div>
</p>
</body>
</html>
